<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Partner</title>
		<link rel="stylesheet" type="text/css" href="css/styles.css"/>
		<style>
			#popupDiv {
				border: none;
				position: fixed;
				width: 400px;
				height: 600px;
				top: 50%;
				left: 50%;
				margin-left: -200px;
				margin-top: -300px;
			}
			#popupFrame {
				width: 100%;
				height: 100%;
				border: none;
				margin: 0px;
			}
		</style>
		<script>
			var popupDiv;
			
			function divOnClick() {
				
				window.open("index.xhtml?choiceMode=1", "_blank",'height=400,width=400,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
				return;
				
				if (popupDiv == null) {
					
					popupDiv = document.createElement("DIV");
					popupDiv.id = "popupDiv";
					
					var frame = document.createElement("IFRAME");
					frame.id = "popupFrame";
					frame.src = "index.xhtml?choiceMode=1";
					frame.onload = 
					
					function () {
						try {
							frame.contentDocument.documentElement.setAttribute("popupElementId", "popupDiv");
						} catch (err) {
							alert(err.message);
						}
					};
					
					popupDiv.appendChild(frame);
					
					document.body.appendChild(popupDiv);
					
				} else {
					document.body.removeChild(popupDiv);
					popupDiv = null;
				}
			}
			
			function clearParent() {
				try {
					document.getElementById("form:parentId").value = "";
					document.getElementById("form:parentName").value = "";
				} catch (err) {
					alert(err.message);
				}
			}
		</script>
    </h:head>
    
    <f:metadata>
        <f:viewParam name="id" value="#{partnerManagedBean.id}"/>
    </f:metadata>
    
    <h:body>
        <h:form id="form">
            <h:inputHidden id="id" value="#{partnerManagedBean.id}"/>
			
            <h:inputHidden id="parentId" value="#{partnerManagedBean.parentId}"/>
            
			<h:outputLabel for="parentName" value="Parent: "/>
			<h:inputText id="parentName" value="#{partnerManagedBean.parentName}" readonly="true"/>
			<input type="button" onclick="divOnClick();" value="..." style="margin: 0px"/>
			<input type="button" onclick="clearParent();" value="X" style="margin: 0px"/>
			<br/><br/>
			
			<h:outputLabel for="code" value="Code: "/>
            <h:inputText id="code" value="#{partnerManagedBean.code}" size="30"/>
            <br/><br/>
            <h:outputLabel for="name" value="Name: "/>
            <h:inputText id="name" value="#{partnerManagedBean.name}" size="30"/>
            <br/><br/>
			<h:selectBooleanCheckbox id="isFolder" value="#{partnerManagedBean.isFolder}"/>
			<h:outputLabel for="isFolder" value="is folder"/>
            <br/><br/>
			<h:selectBooleanCheckbox id="deletionMark" value="#{partnerManagedBean.deletionMark}"/>
			<h:outputLabel for="deletionMark" value="deletion mark"/>
            <br/><br/>
            <h:commandButton id="save" action="index.xhtml?faces-redirect=true" actionListener="#{partnerManagedBean.save}" value="Save" />
        </h:form>
    </h:body>
</html>
